<template>
  <div class="sync">
    <img class="sync-avt" :src="data.avatar"></img>
    <div class="sync-des">{{ data.description }}</div>
  </div>
</template>

<!-- 直接在 setup 里面使用 await 会触发 Vue 的顶层 async 技术，会将组件变成异步组件 -->
<script setup lang="ts">
import { axios } from "../../server/axios.ts";

interface IData {
  data: {
    avatar: string;
    description: string;
  }
}

const { data } = await axios.get<IData>("./public/data.json");
</script>

<style scoped lang="scss">
.sync {
  display: flex;
  align-items: center;
  justify-content: center;

  &-avt {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #eee;
  }

  &-des {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 10px;
    width: 100px;
    height: 30px;
    color: green;
    border-radius: 4px;
    background: #eee;
  }
}
</style>
